import org.apache.flink.api.scala._

/**
 * @Author: DRevelation
 * @Date: 2022/3/21 16:46
 */
object WordCountBatch {
  def main(args: Array[String]): Unit = {
    val benv = ExecutionEnvironment.getExecutionEnvironment
    val dataSet = benv.readTextFile("D:\\gitee\\framework-base\\flink\\src\\main\\scala\\wordcount.txt")
    dataSet.flatMap {
      _.toLowerCase.split(",")
    }
      .filter(_.nonEmpty)
      .map {
        (_, 1)
      }
      .groupBy(0)
      .sum(1)
      .print()
  }
}
